package com.github.lzm320a99981e.autocoding.domain.mybatis;

import com.github.lzm320a99981e.autocoding.domain.Entity;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 基础 Mapper
 *
 * @param <E>  实体
 * @param <ID> 主键
 */
public interface BaseRepository<E extends Entity, ID> {
    int insert(E entity);

    int insertSelective(E entity);

    int deleteByPrimaryKey(ID id);

    int deleteByPrimaryKeys(List<ID> ids);

    int updateByPrimaryKey(E entity);

    int updateByPrimaryKeySelective(E entity);

    E selectByPrimaryKey(ID id);

    List<E> selectByPrimaryKeys(List<ID> ids);

    List<E> selectAll();

    List<E> selectByEntity(E entity);

    List<E> selectByConditions(Map conditions);

    int insertBatch(List<E> entities);

    int updateBatch(List<E> entities);

    Long count();

    Map<String,Object> selectByFunction(@Param("function") String function, @Param("column") String column);
}
